<template>
    <div class="head">
      <span>{{title}}</span> 
      <span class="time">{{ dateTime }}</span>
      <span class="week">{{ week }}  <span style="margin-left: .0521rem;">{{ temperature }}   {{ text }}</span></span>
  </div>
</template>

<script>
import {getNowTime,getNowWeek} from '@/utils/common.js'
import {getlandStatistics} from "@/api"
export default {
    props:['title'],
  data() {
      return {
          name: "",
    dateTime: '',
    week:'',
    temperature:'',
    text:''
      }
  },
  mounted() {
      setInterval(() => {
      this.dateTime = getNowTime()
  }, 1000);
  this.week = getNowWeek()
  this.getNewTianqi()
  },
  methods: {
  getNewTianqi(){
      getlandStatistics().then(res=>{
          console.log(res);
          this.temperature = res.data.results[0].now.temperature+'℃'
          this.text = res.data.results[0].now.text
      })
  }
},
}
</script>

<style lang="scss" scoped></style>